<script>
export default {
  name: "index",
  data() {
    return {
      user: {

      },
    }
  },
  onLoad({ id }) {
    this.$api.getLayers(id).then(res => {
      this.user = res
    })
  },
  methods: {
    navBack() {
      this.$u.route({
        type: 'navigateBack'
      })
    },
    routeTo(path) {
      if (path) {
        this.$u.route({
          type: 'navigateTo',
          url: path
        })
      }
    },
    addComment() {
      this.$u.route({
        type: 'navigateTo',
        url: '/pages/LawAsk/chat?id=' + this.user.id
      })
    },
  }
}
</script>

<template>
  <div class="LawyerDetail">
    <div class="custom-home-header">
      <div class="title">EasyLaw</div>
      <div class="sub-title">The elbsest ingel ald far ntemsrtlens students</div>
    </div>
    <div class="back-top" @click="navBack">
      <u-icon name="arrow-left" size="28"></u-icon>
      <span class="back-name">Lawyer Profile</span>
    </div>
    <div class="video-detail">
      <div class="card-item">
        <div class="comment-user">
          <div class="avatar">
            <img :src="user.image" alt="">
          </div>
          <div class="userinfo">
            <div>{{ user.nickname }}</div>
            <div>{{ user.address }}</div>
            <div>License Number：{{ user.num }}</div>
          </div>
        </div>
      </div>
      <div class="card-item card-item2">
        <u-checkbox shape="circle"  active-color="rgb(254,149,66)" :value="user.professional_certification== 1" name="">Professional Certification</u-checkbox>
        <u-checkbox shape="circle" active-color="rgb(254,149,66)" :value="user.platform_authentication==1" name="">Platform Authentication</u-checkbox>
      </div>
      <div class="card-item card-item3">
        <div class="card-title">Baslc information</div>
        <div class="cell-item">
          <div class="cell-name">Educaticnal Background</div>
          <div class="cell-value">
            {{ user.background }}
          </div>
        </div>
        <div class="cell-item">
          <div class="cell-name">Highest Education Level</div>
          <div class="cell-value">
            {{ user.max_background }}
          </div>
        </div>
        <div class="cell-item">
          <div class="cell-name">Years in Practice</div>
          <div class="cell-value">
            {{ user.year }} years
          </div>
        </div>
        <div class="cell-item">
          <div class="cell-name">Areas of Epertise</div>
          <div class="cell-value">
            {{ user.area }}
          </div>
        </div>
      </div>
      <div class="card-item card-item3">
        <div class="card-title">Profile</div>
        <div class="card-desc">{{ user.profile }}</div>
      </div>
      <button class="confirm-btn" @click="addComment">Consult him/her </button>
    </div>
  </div>
</template>

<style  lang="scss">
.LawyerDetail {
  .confirm-btn{
    width: 630upx;
    height: 70upx;
    line-height: 70upx;
    border-radius: 5px;
    margin-top: 70upx;
    background: rgb(254,149,66);
    color: #fff;
    font-size: $font-lg;
    &:after{
      border-radius: 100px;
    }
  }
  .card-item{
    display: flex;
    flex-direction: column;
    padding: 20rpx;
    background-color: rgb(251,251,251);
    border-radius: 8px;
    margin-bottom: 10px;
    .card-title {
      font-size: 28rpx;
      font-weight: bold;
      color: #333333;
      margin-bottom: 24rpx;
    }
    .comment-user {
      display: flex;
      .avatar {
        width: 60rpx;
        height: 60rpx;
        img {
          width: 100%;
          height: 100%;
          border-radius: 50%;
        }
      }
      .userinfo {
        margin-left: 20rpx;
        display: flex;
        flex-direction: column;
        justify-content: center;
        div {
          font-size: 24rpx;
          color: #333333;
        }
      }
    }
    .comment-content {
      margin-left: 80rpx;
      font-size: 28rpx;
      color: #666666;
      margin-top: 20rpx;
    }
  }
  .card-item.card-item2 {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    .u-checkbox__label {
      font-size: 24rpx !important;
    }
  }
  .card-item.card-item3 {
    .cell-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10rpx 0;
      .cell-name {
        font-size: 24rpx;
        color: #999999;
      }
      .cell-value {
        color: #333333;
      }
    }
  }
  .custom-home-header {
    height: 100rpx;
    background-color: #409eff;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    .title {
      font-size: 36rpx;
      line-height: 100rpx;
      padding-left: 50rpx;
    }
    .sub-title {
      font-size: 24rpx;
      color: #a6a2a2;
      margin-left: 20rpx;
      padding-top: 50rpx;
    }
  }

  .back-top {
    display: flex;
    align-items: center;
    padding: 20rpx 0;
  }
  .back-name {
    margin-left: 20rpx;
    font-size: 28rpx;
    color: #333333;
  }
  .video-detail {
    padding: 20rpx 40rpx;
    img {
      width: 100%;
    }
    .person {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      font-size: 24rpx;
      color: #999999;
      margin-top: 20rpx;
    }
    .title {
      font-size: 28rpx;
      color: #333333;
      margin-top: 20rpx;
      font-weight: bold;
    }
    .desc {
      font-size: 28rpx;
      color: #666666;
      margin-top: 20rpx;
      font-weight: bold;
    }
  }
}
</style>
